<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * View file: category_form
 *
 * @author luubk
 * @since 12-06-2012 - 01:15:59
 */
?>
<div id="form_result"></div>
<article class="module width_full">
    <form method="POST" id="form" 
          action="<?php echo $id ? site_url("apps/category_form/$id") : site_url("apps/category_form") ?>">
        <header><h3><?php echo $title ?></h3></header>
        <div class="module_content">

            <fieldset style="width:48%; float:left; margin-right: 3%;">
                <label>Tên danh mục</label>
                <input type="text" style="width:92%;" value="<?php echo isset($item['cate_name']) ? $item['cate_name'] : '' ?>"
                       name="cate_name" required="required">
            </fieldset>
            <fieldset style="width:48%; float:right;">
                <label>URL</label>
                <input type="text" style="width:92%;" value="<?php echo isset($item['cate_url']) ? $item['cate_url'] : '' ?>"
                       name="cate_url" required="required">
            </fieldset>
            
            <fieldset style="width:48%; height: 170px; float:left; margin-right: 3%;">
                <label>Hình đại diện</label>
                <div class="clear"></div>
                <div style="padding: 0 10px">                    
                    <span>
                        <a href="#" id="thumb_link">
                            <?php
                            $thumb = ($item['cate_thumb'] != '') ? site_url('photo/gate/' . urlencode(urlencode($item['cate_thumb']))) : base_url() . 'assets/css/_common/images/image.png';
                            ?>
                            <img src="<?php echo $thumb ?>" 
                                 style="max-height:128px;max-width:128px"/>
                        </a>
                        <input type="hidden" value="<?php echo $item['cate_thumb'] ?>" name="cate_thumb"/>
                    </span>                                            
                </div>
            </fieldset>
            <fieldset style="width:48%; float:right;">
                <label>Mô tả</label>
                <textarea rows="6" style="width:92%;" 
                          name="cate_desc"><?php echo isset($item['cate_desc']) ? $item['cate_desc'] : '' ?></textarea>
            </fieldset>

            <fieldset style="width:48%; float:right;">
                <label>SEO</label>
                <textarea rows="5" style="width:92%;" 
                          name="cate_seo"><?php echo isset($item['cate_seo']) ? $item['cate_seo'] : '' ?></textarea>
                Nội dung hiển thị cho bộ máy tìm kiếm
            </fieldset>
            <fieldset style="width:48%; float:left; margin-right: 3%;">
                <label>Danh mục cha</label>
                <select name="cate_parent">
                    <option value="0"> * Danh mục gốc</option>
                    <?php echo $cate_select_box ?>
                    </select>
            </fieldset>

            <fieldset style="width:48%; float:left; margin-right: 3%;">
                <label>Thứ tự</label>
                <input type="text" style="width:92%;" value="<?php echo isset($item['cate_rank']) ? $item['cate_rank'] : 1 ?>"
                       name="cate_rank" required="required">
            </fieldset>

            <div class="clear"></div>
        </div>
        <footer>
            <div class="submit_link">
                <span class="loading">&nbsp;</span>
                <select name="cate_status">
                    <option value="1" <?php echo (isset($item['cate_status']) && $item['cate_status'] == 1) ? 'selected="selected"' : '' ?>>Kích hoạt</option>
                    <option value="0" <?php echo (isset($item['cate_status']) && $item['cate_status'] == 0) ? 'selected="selected"' : '' ?>>Vô hiệu hóa</option>
                </select>
                <input type="submit" value="Lưu lại" class="alt_btn">
                <input type="reset" value="Nhập lại">                
            </div>
        </footer>
    </form>
</article><!-- end of post new article -->


<div id="thumb_dialog" title="Upload ảnh đại diện cho ứng dụng từ máy của bạn">
    <div id="thumb_result" style="text-align: center"></div>
    <form method="POST" enctype="multipart/form-data"
          action="<?php echo site_url('apps/upload_thumb') ?>" id="thumb_frm" >        
        <input type="file" name="userfile" size="20" id="thumb_file"/>        
        <div class="progressbar"></div>
    </form>    
</div>
